package com.ming.common.realm;

import org.apache.shiro.spring.web.config.DefaultShiroFilterChainDefinition;
import org.apache.shiro.spring.web.config.ShiroFilterChainDefinition;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Author:何元才
 * @Desc:
 * @data:2021-04-11 16:20
 */
@Configuration
public class ShiroConfig {

    @Bean
    public ShiroFilterChainDefinition shiroFilterChainDefinition() {
        DefaultShiroFilterChainDefinition filterChainDefinition = new DefaultShiroFilterChainDefinition();
        //设置放行的请求路径
        filterChainDefinition.addPathDefinition("/index", "anon");

        filterChainDefinition.addPathDefinition("/login", "anon");
        filterChainDefinition.addPathDefinition("/resources/**", "anon");
        filterChainDefinition.addPathDefinition("/sysuser/login.do", "anon");
        //设置需要认证的路径
        filterChainDefinition.addPathDefinition("/**", "authc");
        return filterChainDefinition;


    }
}





